Import data
Warning: package 'dplyr' was built under R version 3.4.1
Fit mixture model with R if not already available. Exists =
Unfortunately the differences between MATLAB and R are not trivial. Not substantial either! but we’d prefer trivial.
The mean discrepancy (mean of the absolute value of the difference of the parameter estimates) for efficacy (effDiff), latency (latDiff), and precision (preDiff) is
effDiff latDiff preDiff
1 0.126 0.217 0.262
Now we report the bias difference: the mean difference without taking the absolute value. Note that the negLogLikelihood for the MATLAB estimates is calculated by R, because Pat’s code doesn’t save the negative log likelihoods. Also in R we now use integration of the whole area under the bin, whereas Pat used the height of the density function in the center of the bin.
effDiff latDiff preDiff negLogL_Diff
1 -0.013 0.054 0.017 -8.153
Negative numbers above mean that MATLAB gives slightly higher efficacy and trivially higher precision. For likelihood, lower neg log likelihood is better, so the negative number means R did better.
Let’s inspect histogram plots and fits. Note that in every case, the negative log likelihood is better (smaller) for R, showing that the R code provides a better fit than the MATLAB code.